export default {
  data() {
    return {
      share: {
        title: '聚联科技',
        path: '/pages/index/index',
        imageUrl: '',
        desc: '',
        content: ''
      }
    }
  },
  methods: {
    setTabBarIndex(index) {
      if (typeof this.$mp.page.getTabBar === 'function' && this.$mp.page.getTabBar()) {
        this.$mp.page.getTabBar().setData({
          active: index
        })
      }
    }
  },

  // 分享触发的回调 => <button open-type="share">转发</button>
  onShareAppMessage() {
    const { title, path, imageUrl, desc, content } = this.share
    return {
      title,
      path,
      imageUrl,
      desc,
      content,
      success(res) {
        uni.showToast({
          title: '分享成功'
        })
      },
      fail(res) {
        uni.showToast({
          title: '分享失败',
          icon: 'none'
        })
      }
    }
  }
}
